<?php
/**
 * 基类控制器
 *
 */
namespace app\modules\api\controllers;

use Yii;
use yii\web\Controller;
use yii\web\Response;

class BaseController extends Controller 
{
	/**
     * @inheritdoc
     */
    public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
        ];
    }
    /**
     * API响应数据方法
     * @param integer $status 状态码
     * @param array $data 数据
     * @param string $msg 提示信息
     */
    public function apiRsp($status = 0,$data,$msg = "ok")
    {
    	$response = Yii::$app->response;
		$response->format = Response::FORMAT_JSON;
		$response->data = ["status" => $status,"message" => $msg,"data" => $data];
		$response->send();
    }
}